using MediatR;
using Medical.Api.Write.Application.Command.Wms.WmsStoresCommand;
using Medical.ErrorCode;
using Medical.Api.Write.Service.WmsService;
using System.Threading;
using System.Threading.Tasks;

namespace Medical.Api.Write.Application.Handler.Wms.WmsStoresHandler
{
    /// <summary>
    /// 通过入库主键Id批量添加存放数据处理器
    /// </summary>
    public class BatchAddStoresFromStorageHandler : IRequestHandler<BatchAddStoresFromStorageCommand, ApiResult<bool>>
    {
        private readonly IWmsService _service;
        public BatchAddStoresFromStorageHandler(IWmsService service) { _service = service; }
        public async Task<ApiResult<bool>> Handle(BatchAddStoresFromStorageCommand request, CancellationToken cancellationToken)
        {
            return await _service.BatchAddStoresFromStorageAsync(request.StorageId);
        }
    }
}